<script lang="javascript">
    var BASEURL = "{{ url_for('index') }}";
    var API_BASEURL = BASEURL + "api/";
    var PLUGIN_BASEURL = BASEURL + "plugin/";
    var GCODE_WORKER = "{{ url_for('static', filename='gcodeviewer/js/Worker.js') }}";

    var CONFIG_DEBUG = {%  if debug -%} true; {% else %} false; {%- endif %}

    var CONFIG_GCODEFILESPERPAGE = 5000;
    var CONFIG_TIMELAPSEFILESPERPAGE = 10;
    var CONFIG_LOGFILESPERPAGE = 10;
    var CONFIG_USERSPERPAGE = 10;
    var CONFIG_WEBCAM_STREAM = "{{ webcamStream|e }}";
    var CONFIG_ACCESS_CONTROL = {% if enableAccessControl -%} true; {% else %} false; {%- endif %}
    var CONFIG_SD_SUPPORT = {% if enableSdSupport -%} true; {% else %} false; {%- endif %}
    var CONFIG_FIRST_RUN = {%  if firstRun -%} true; {% else %} false; {%- endif %}
    var CONFIG_TEMPERATURE_GRAPH = {%  if enableTemperatureGraph -%} true; {% else %} false; {%- endif %}
    var CONFIG_GCODE_SIZE_THRESHOLD = {{ gcodeThreshold|e }};
    var CONFIG_GCODE_MOBILE_SIZE_THRESHOLD = {{ gcodeMobileThreshold|e }};

    var SOCKJS_URI = "{{ url_for('index') }}" + "sockjs";
    var SOCKJS_DEBUG = CONFIG_DEBUG;
    // sockjs should define CLOSE_NORMAL for us, but they don't (from ws spec)
    var SOCKJS_CLOSE_NORMAL = 1000;

    var UI_API_KEY = "{{ uiApiKey|e }}";
    var VERSION = "{{ version|e }}";
    var DISPLAY_VERSION = "{{ display_version|e }}";
    var BRANCH = "{{ branch|e }}";
    var LOCALE = "{{ g.locale|e }}";
    var AVAILABLE_LOCALES = {{ locales|tojson }};

    var OCTOPRINT_VIEWMODELS = [];
    var ADDITIONAL_VIEWMODELS = [];
    var OCTOPRINT_ADDITIONAL_BINDINGS = [];

    {% if templates.tab.order %}
        {% set first_tab = templates.tab.order[0] %}
        {% set entry, data = templates.tab.entries[first_tab] %}
        var OCTOPRINT_INITIAL_TAB = "#{{ data._div }}";
    {% else %}
        var OCTOPRINT_INITIAL_TAB = undefined;
    {% endif %}
</script>
